<?

require_once ("application.list.inc");

global $_GLOBAL_DBH;
global $_OBJECT_IFACE_PANEL;
global $_IFACE_CONTROL_OBJECT;
global $_SET_TABBING;

$_SET_TABBING = true;

$fs_local_document = $_REQUEST["PHP_SCRIPT"];

$lc_ass_tra_maintenance = array (
	category=>array (label=>"Category",order=>"DEFAULT",wrapper=>"vmc_icon_method"),
	status=>array (label=>"Status",order=>"DEFAULT",wrapper=>"vmc_icon_method"),
	asset_description=>array (label=>"Description",order=>"DEFAULT",
			callback=>"_template_list_substring",length=>16),
	cdate=>array (label=>"Create Date",order=>"DEFAULT",wrapper=>"vmc_icon_date"),
);

$link_options_path = array (
	array (
		fs_tab=>"ass_tra_maintenance",
		fs_tab_option=>"lc_ass_tra_maintenance",
		object_id=>"asset_id",
		object_value=>$_REQUEST["asset_id"],
	)
);

$link_options = _app_create_tabbing (null, $link_options_path);

$object_ctl_path = array (
	array (
		fs_action=>"view",
		fs_tab=>"ass_tra_maintenance",
		fs_tab_option=>"fs_ass_tra_maintenance",
		object_id=>"asset_id",
		object_value=>$_REQUEST["asset_id"],
	)
);

$object_ctl = _app_create_tabbing ( "{$fs_local_document}?",
		$object_ctl_path) . "&";

$list_options_path = array (
	array (
		fs_action=>"addnew",
		fs_tab=>"ass_tra_maintenance",
		fs_tab_option=>"fs_ass_tra_maintenance",
		object_id=>"asset_id",
		object_value=>$_REQUEST["asset_id"],
	)
);

$list_options = array (
	array (
		label=>"Enter Asset Maintenance",
		link=>_app_create_tabbing ("{$fs_local_document}?", $list_options_path)
	),
);

$_OBJECT_IFACE_LIST = _app_create_list_object (array (
                db_conn=>$_GLOBAL_DBH,
                indexes=>$lc_ass_tra_maintenance,
		list_count=>"SELECT COUNT(*) FROM ass_tra_maintenance WHERE asset_id={$_REQUEST["asset_id"]}",
		list_select=>"SELECT ass_tra_maintenance.*,ass_tra_status.name AS status,ass_tra_categories.name AS category FROM ass_tra_maintenance,ass_tra_status,ass_tra_categories WHERE asset_id={$_REQUEST["asset_id"]} AND status_id=ass_tra_status.id AND category_id=ass_tra_categories.id",
                list_id=>"lc_ass_tra_maintenance",
                list_options=>$list_options,
                primary_key=>"id",
                primary_relation=>"maintenance_id",
                link_options=>$link_options,
                object_ctl=>$object_ctl
));

array_push ($_IFACE_CONTROL_OBJECT, $_OBJECT_IFACE_LIST);

?>
